function stockTree = InitStockTree(priceZero, volatility, N)

% This function creates an array containing stock prices.
% The values are computed using a binomial tree model.
% Parameters:
%     priceZero:     the initial stock price.
%     volatility:    volatility of the stock
%     N:             number of steps to use in the tree



% Compute the up and downwards multiplication values.
up = exp(volatility * sqrt(1 / N));
down = exp(-volatility * sqrt(1 / N));

% Compute the stock tree.
stockTree = zeros(N, N);
for j = 1 : N,
    for i = 1 : j,
        stockTree(i, j) = priceZero * up ^ (j- i)* (down ^ (i - 1));
    end
end
        
        
